//
//  FeedBackHttpRequest.m
//  HappilyLoan
//
//  Created by 纵情向前 on 2017/4/11.
//  Copyright © 2017年 zongqingxiangqian. All rights reserved.
//

#import "ZFMyInfoHttpRequest.h"
#import "ZFHttpTool.h"
#import "ZFHeader.h"
#import "MD5Util.h"
@implementation ZFMyInfoHttpRequest
//上传用户反馈信息
+ (void)requestFeedBackUser_id:(NSString *)user_id feedBack_content:(NSString *)feedback_content photo_files:(NSData *)thePhoto_files sucessBlock:(void (^)(NSDictionary *))successBlock failureBlock:(void (^)(NSInteger))failureBlock{
    NSDictionary *feedBackDic = @{@"user_id":user_id,@"feedback_content":feedback_content,@"photo_files":thePhoto_files};
    NSString *bodyStr = [ZFHttpTool sortBodyStr:feedBackDic];
    
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
    manager.responseSerializer.acceptableContentTypes = nil;
    manager.securityPolicy = [AFSecurityPolicy defaultPolicy];
    manager.securityPolicy.validatesDomainName = NO;
//    NSString *userId = [[NSUserDefaults standardUserDefaults] objectForKey:@"userid"];
    
    [ZFHttpTool postWithURL:[NSString stringWithFormat:@"%@/user/postAppOpenRecord",SERVERIP] params:feedBackDic bodyStr:bodyStr success:^(id responseObject) {
        
//        NSLog(@"%@-----%@",responseObject,responseObject[@"msg"]);
        successBlock(responseObject);
    } failure:^(NSError *error) {
        failureBlock(1);
    }];
}
//查询银行卡信息
+ (void)requestBankCardInfosucessBlock:(void(^)(NSDictionary *dict))successBlock failureBlock:(void(^)(NSInteger failSign))failureBlock
{
    NSDictionary *bodyParameter = @{@"user_id":[ZFPulicAPI getUserid]};
    
    NSString *bodyStr = [ZFHttpTool sortBodyStr:bodyParameter];
    
    [ZFHttpTool postWithURL:[NSString stringWithFormat:@"%@/archives/findUserBankcardInfo",SERVERIP] params:bodyParameter bodyStr:bodyStr success:^(id responseObject) {
    
//        NSLog(@"%@-%@",responseObject,responseObject[@"msg"]);
        
        successBlock(responseObject);
//        [[NSNotificationCenter defaultCenter] postNotificationName:@"BankCardInfo" object:responseObject];
    } failure:^(NSError *error) {
        failureBlock(1);
    }];
}

//查询身份认证信息
+ (void)requestfindUserIdentitysucessBlock:(void (^)(NSDictionary *dict))successBlock failureBlock:(void (^)(NSInteger))failureBlock{
    
    NSDictionary *bodyParameter = @{@"user_id":[ZFPulicAPI getUserid]};
    
    NSString *bodyStr = [ZFHttpTool sortBodyStr:bodyParameter];
    
    [ZFHttpTool postWithURL:[NSString stringWithFormat:@"%@/archives/findUserIdentityInfo",SERVERIP] params:bodyParameter bodyStr:bodyStr success:^(id responseObject) {
        
//        NSLog(@"%@-%@",responseObject,responseObject[@"msg"]);
        
        successBlock(responseObject);
    } failure:^(NSError *error) {
        failureBlock(1);
    }];
}
//查询用户基础信息
+ (void)requestfindUserBasicInfosucessBlock:(void (^)(NSDictionary *))successBlock failureBlock:(void (^)(NSInteger))failureBlock{
    
    NSDictionary *bodyParameter = @{@"user_id":[ZFPulicAPI getUserid]};
    
    NSString *bodyStr = [ZFHttpTool sortBodyStr:bodyParameter];
    
    [ZFHttpTool postWithURL:[NSString stringWithFormat:@"%@/archives/findUserBasicInfo",SERVERIP] params:bodyParameter bodyStr:bodyStr success:^(id responseObject) {
        
        NSLog(@"%@-%@",responseObject,responseObject[@"msg"]);
        successBlock(responseObject);
    } failure:^(NSError *error) {
        failureBlock(1);
//        NSLog(@"%@",error);
    }];
}

@end
